<template>
  <div class="home">
    <h1>欢迎, {{ user.username }}</h1>
    <p>您的角色: {{ user.role }}</p>
  </div>
</template>

<script>
export default {
  name: 'Home',
  computed: {
    user() {
      // 从 localStorage 获取用户数据
      const userData = localStorage.getItem('user')
      return userData ? JSON.parse(userData) : { username: '访客', role: 'guest' }
    }
  }
}
</script>